package com.web.new12306.service.impl;

import java.sql.Connection;
import java.util.List;

import com.web.new12306.dao.OrderDao;
import com.web.new12306.dao.impl.OrderDaoImpl;
import com.web.new12306.pojo.Order;
import com.web.new12306.pojo.Page;
import com.web.new12306.pojo.Page1;
import com.web.new12306.pojo.Ticket;
import com.web.new12306.service.OrderService;
import com.web.new12306.util.DaoUtil;

public class OrderServiceImpl implements OrderService {
	/**
	 * @author 赵靖懿
	 */

	@Override
	public List<Order> queryOrders(Integer pages, Integer rows) {
		// TODO Auto-generated method stub
		Connection conn=DaoUtil.getConnection();
		OrderDao  odao = new OrderDaoImpl();
		List<Order> list=odao.select(conn, pages, rows);
		return list;
	}

	@Override
	public int number() {
		// TODO Auto-generated method stub
		Connection conn=DaoUtil.getConnection();
		OrderDao  odao = new OrderDaoImpl();
		int number =odao.number(conn);
		return number;
	}
	@Override
	public Page1 showTickets(Ticket ticket, int page, int rows) {
		// TODO Auto-generated method stub
		Connection conn=DaoUtil.getConnection();
		Page1 p=null;
		OrderDao od=new OrderDaoImpl();
		p=od.showTickets(conn, ticket, page, rows);
		return p;
	}

	@Override
	public Ticket getTicketByTicketId(int ticketId) {
		// TODO Auto-generated method stub
		Connection conn=DaoUtil.getConnection();
		OrderDao od=new OrderDaoImpl();
		Ticket ticket=od.getTicketByTicketId(conn, ticketId);
		return ticket;
	}

	@Override
	public int addOrder(Order order) {
		// TODO Auto-generated method stub
		Connection conn=DaoUtil.getConnection();
		OrderDao od=new OrderDaoImpl();
		int r=od.addOrder(conn, order);
		return r;
	}


}
